/*  
*this do-file reproduces Figure 1 of the paper. 


Requires the clean dataset:
building_level_data.dta

Arianna Salazar Miranda
*/

clear all
global project "/Users/arianna/Dropbox (MIT)/emporis_project/paper/submission_PLOS/data_repository"

use "${project}/Data/building_level_data.dta", clear

**************************************************************************************************
*Create mean variables
**************************************************************************************************

bysort r50_count_picData_2011: egen mean_2014=mean(r50_count_picData_2014)
bysort r50_count_picData_2011: egen count_2014=count(r50_count_picData_2014)
bysort r50_count_picData_2014: egen flickr_mean_2014=mean(r50_count_picData_flickr)

**************************************************************************************************
*Figure 1 (left panel)
**************************************************************************************************

twoway (scatter mean_2014 r50_count_picData_2011, mcolor(cranberry) msize(medsmall)), /// 
ytitle(, margin(medium)) yscale(noline) ylabel(#5, labsize(small) labcolor(gs11) labgap(vsmall) ticks tlcolor(gs13) grid glwidth(vthin) glcolor(gs13) gextend) ///
xtitle(, margin(medium)) xscale(noline) xlabel(, labsize(small) labcolor(gs11) labgap(small) noticks grid glwidth(vthin) glcolor(gs13) gextend) legend(nobox) ///
xsize(3) ysize(4) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(none)) plotregion(fcolor(white) ilcolor(none)) ///
xtitle("Number of photos (Panoramio 2011)", size(3)) ytitle("Mean number of photos (Panoramio 2014)", size(3))

**************************************************************************************************
*Figure 1 (right panel)
**************************************************************************************************

twoway (scatter flickr_mean_2014 r50_count_picData_2014, mcolor(cranberry) msize(medsmall)), /// 
ytitle(, margin(medium)) yscale(noline) ylabel(#5, labsize(small) labcolor(gs11) labgap(vsmall) ticks tlcolor(gs13) grid glwidth(vthin) glcolor(gs13) gextend) ///
xtitle(, margin(medium)) xscale(noline) xlabel(, labsize(small) labcolor(gs11) labgap(small) noticks grid glwidth(vthin) glcolor(gs13) gextend) legend(nobox) ///
xsize(3) ysize(4) graphregion(fcolor(white) lcolor(none) ifcolor(white) ilcolor(none)) plotregion(fcolor(white) ilcolor(none)) ///
xtitle("Number of photos (Panoramio 2014)", size(3)) ytitle("Mean number of photos (Flickr 2014)", size(3))
